package io.renren.modules.sys.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.modules.sys.entity.SignInLogEntity;
import io.renren.modules.sys.service.SignInLogService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 签到日志表
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-07-29 20:42:31
 */
@RestController
@RequestMapping("generator/signinlog")
public class SignInLogController {
    @Autowired
    private SignInLogService signInLogService;

    /**
     * 列表
     */
    @RequestMapping("/list")

    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = signInLogService.queryPage(params);

        return R.ok().put("page", page);
    }

    /**
     * 列表
     */
    @RequestMapping("/lists")

    public R lists(@RequestParam Map<String, Object> params){
        List<SignInLogEntity> signInLogEntities = signInLogService.queryPageS(params);
        return R.ok().put("page", signInLogEntities);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    @RequiresPermissions("generator:signinlog:info")
    public R info(@PathVariable("id") Integer id){
		SignInLogEntity signInLog = signInLogService.getById(id);

        return R.ok().put("signInLog", signInLog);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("generator:signinlog:save")
    public R save(@RequestBody SignInLogEntity signInLog){
		signInLogService.save(signInLog);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("generator:signinlog:update")
    public R update(@RequestBody SignInLogEntity signInLog){
		signInLogService.updateById(signInLog);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("generator:signinlog:delete")
    public R delete(@RequestBody Integer[] ids){
		signInLogService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
